package com.cw.realtime.common
package bean
import scala.collection.mutable

case class TradeProvinceOrderBean(
  province_id: String,
  order_detail_id: String,
  order_id_set: mutable.Set[String],
  order_count: Long,
  order_amount: BigDecimal,
  ts: Long,
  province_name: String = "",
  stt: String = "",
  edt: String = "",
  cur_date: String = "",

) extends RichBean[TradeProvinceOrderBean] {

  override def +(that: TradeProvinceOrderBean): TradeProvinceOrderBean = {
    order_id_set ++= that.order_id_set
    TradeProvinceOrderBean(province_id, order_detail_id, order_id_set, order_id_set.size, order_amount + that.order_amount, ts, province_name, stt, edt, cur_date)
  }


  override def transWindowRange(stt: String, edt: String, cur_date: String): TradeProvinceOrderBean =
    TradeProvinceOrderBean(province_id, order_detail_id, order_id_set, order_count, order_amount, ts, province_name, stt, edt, cur_date)

  def transProvinceName(province_name: String): TradeProvinceOrderBean =
    TradeProvinceOrderBean(province_id, order_detail_id, order_id_set, order_count, order_amount, ts, province_name, stt, edt, cur_date)

}

